import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
// 最大级别的组件会显示在App.vue中
const routes = [
  // 这里配置路由规则，级别最高的路径对应显示的组件是放在App.vue的占位符显示
  { path: '/login', component: () => import('@/views/Login.vue') },
  { path: '/reg', component: () => import('@/views/Reg.vue') },
  {
    path: '/',
    // 当hash地址为/的时候，就重定向到/home地址，展示echarts图表页
    redirect: 'home',
    component: () => import('@/views/Home.vue'),
    children: [
      { path: 'home', component: () => import('@/views/Menu/Main/Main.vue') },
      { path: 'user-info', component: () => import('@/views/Menu/User/UserInfo.vue') },
      { path: 'user-avatar', component: () => import('@/views/Menu/User/ReAvatar.vue') },
      { path: 'user-pwd', component: () => import('@/views/Menu/User/RePwd.vue') },
      { path: 'art-cate', component: () => import('@/views/Menu/Article/ArtiCate.vue') },
      { path: 'art-list', component: () => import('@/views/Menu/Article/ArtList.vue') }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
